<?php
namespace Home\Controller;
use Think\Controller;
class RecordController extends BaseController {

   
 

       public function   myrecords()
    { 
           $map['user_id']=session('user.id');
           $map['paystatus']=1;
      $lists=M('order')->where($map)->select(); 
      $total=M('order')->where($map)->sum('order_num'); 
        
        $this->assign('records',$lists);
        $this->assign('total',$total);
       $this->display();
    }


      public function my_lower()
    { 
      $userid=session('user.id');

      $A=A("Admin/Ajax");
      $base = $A->getTreeBaseInfoHome ( $userid );
    $znote = $A->getTreeInfoHome ($userid);
    $znote [] = $base;
    //var_dump($znote);exit();
      $this->assign('team',$znote)->assign("team_nav",1);
      $this->display();
    }


     public function beyond()
    { 
      $map['user_id']=session('user.id');
      $lists=M('beyond_records')->where($map)->select;
      $this->assign('team',$lists);
      $this->display();
    }

 

      public function lower_record()
    { 
      $userid=session('user.id');
      $userinfo=M('user')->find($userid);
      $map['invite_id']=$userid;
      $map['status'] = array(array('egt',1),array('elt',$userinfo['status']),'AND');
      $znote=M('user')->where($map)->select();
      $total_peaple=M('user')->where($map)->count();
      $jbset=M('jbset')->find();
     /* $A=A("Admin/Ajax");
      $base = $A->getTreeBaseInfoHome ( $userid );
    $znote = $A->getTreeInfoHome ($userid);
    $znote [] = $base;
 $total=count($znote);*/
 foreach ($znote as $key => $value) {
  $jb='jb'.$value['status'];
    $znote[$key]['jb']=$jbset[$jb];
 }


 $total=M('user')->where($map)->sum('team_ordernums');
  
      $this->assign('team',$znote);
      $this->assign('total',$total);
      $this->assign('total_peaple',$total_peaple);
      $this->display();
    }

      public function direct_xf_record()
    { 
      $userid=session('user.id');
      $map['invite_id']=$userid;
      $map['status']=1;
      $team=M('user')->where($map)->select();
      $total=M('user')->where($map)->count();
       $total_yj=M('user')->where($map)->sum('ordernums');
      $this->assign('team',$team);
      $this->assign('total',$total);
      $this->assign('total_yj',$total_yj);
      $this->display();
    }

     public function beyond_record()
    { 
      $userid=session('user.id');
      $map['beyond_sj_id']=$userid;
      $team=M('user')->where($map)->select();
      $total=M('user')->where($map)->count();
      $this->assign('team',$team);
      $this->assign('total',$total);
      $this->display();
    }

    
}
